<header >
<#assign calias = "default">
<#if Catalog?has_content>
    <#assign firstAncestor = Catalog.ancestors?split(':')[0]>
    <@cms_catalog id="${firstAncestor}" level="Self">
        <#list DataList as c1>
            <#assign calias = c1.alias>
        </#list>
    </@cms_catalog>
</#if>
<script>
    function goLink() {
        var link = "${IsPreview?then(ApiPrefix, Prefix)}_search${IsPreview?then('?sid='+Site.siteId+'&pp='+PublishPipeCode+'&preview=true', '')}";
        if (link.indexOf('?') > -1) {
            link += "&q=" + $('#header_search').val();
        } else {
            link += "?q=" + $('#header_search').val();
        }
        window.location.href = link +  "&Authorization=" + new URL(window.location.href).searchParams.get('Authorization');

    }

    function set(){
        var height = $("#header-height").height();
        console.log("元素的高度是：" + height + "px");
        $("#header-height-bg").height(height);
    }
    $(window).resize(function() {
        set()
    });
    $(document).ready(function() {
        set()
    });

    window.onload = function() {  
		document.getElementById('header_search').addEventListener('keyup', function(event) {  
		  if (event.key === 'Enter') {
            goLink()
		  }  
		}); 
		document.getElementById('header_search_img').addEventListener('click', function(event) {  
			goLink()
		}); 
	};
</script>
<div class="container header" id="header-height">
    <div class="row">
        <div class="col col-lg-2 logo-box">
            <div class="logo">
                <img src="${Prefix}images/header/path.png" alt="" width="34" height="34">
                <div class="logo-name">数促中心</div> 	
            </div>
        </div>
        <div class="col col-lg-7">
            <div class="nav">
                <#if calias=='default'>
                <div class="nav-name header-active" ><a class="link" href="${Site.link}">首页</a> </div>
                <#else>
                <div class="nav-name" ><a class="link" href="${Site.link}">首页</a> </div>
                </#if>
                
                <@cms_catalog alias="situation" level="Self" size="1">
                    <#list DataList as c1>
                       <@cms_content catalogalias="situation" level="Current" size="1">
                          <#list DataList as content>
                            <#if calias=='situation'>
                            <div class="nav-name header-active" ><a href="${content.link}">${c1.name}</a></div>
                            <#else>
                            <div class="nav-name" ><a href="${content.link}">${c1.name}</a></div>
                            </#if>
                                
                          </#list>
                        </@cms_content>
                    </#list>
                </@cms_catalog >

                <@cms_catalog alias="news" level="Self" size="1">
                    <#list DataList as c1>
                        <@cms_catalog alias="news" level="Child" size="1">
                            <#list DataList as c2>
                                <#if calias=='news'>
                                <div class="nav-name header-active" ><a href="${c2.link}">${c1.name}</a></div>
                                <#else>
                                <div class="nav-name" ><a href="${c2.link}">${c1.name}</a></div>
                                </#if>
                            </#list>
                        </@cms_catalog >
                    </#list>
                </@cms_catalog >
                
                <@cms_catalog alias="construction" level="Self" size="1">
                    <#list DataList as c1>
                        <@cms_catalog alias="construction" level="Child" size="1">
                            <#list DataList as c2>
                                <#if calias=='construction'>
                                <div class="nav-name header-active" ><a href="${c2.link}">${c1.name}</a></div>
                                <#else>
                                <div class="nav-name" ><a href="${c2.link}">${c1.name}</a></div>
                                </#if>
                            </#list>
                        </@cms_catalog >
                    </#list>
                </@cms_catalog >

                <@cms_catalog alias="policy" level="Self" size="1">
                    <#list DataList as c1>
                        <#if calias=='policy'>
                        <div class="nav-name header-active" ><a href="${c1.link}">${c1.name}</a></div>
                        <#else>
                        <div class="nav-name" ><a href="${c1.link}">${c1.name}</a></div>
                        </#if>
                    </#list>
                </@cms_catalog >
              
                <@cms_catalog alias="publicity" level="Self" size="1">
                    <#list DataList as c1>
                        <#if calias=='publicity'>
                        <div class="nav-name header-active" ><a href="${c1.link}">${c1.name}</a></div>
                        <#else>
                        <div class="nav-name" ><a href="${c1.link}">${c1.name}</a></div>
                        </#if>
                    </#list>
                </@cms_catalog >
              
                <@cms_catalog alias="services" level="Self" size="1">
                    <#list DataList as c1>
                    <#if calias=='services'>
                    <div class="nav-name header-active" ><a href="${c1.link}">${c1.name}</a></div>
                    <#else>
                    <div class="nav-name" ><a href="${c1.link}">${c1.name}</a></div>
                    </#if>
                    </#list>
                </@cms_catalog >
                            
                 <@cms_catalog alias="investment" level="Self" size="1">
                    <#list DataList as c1>
                    <#if calias=='investment'>
                    <div class="nav-name header-active" ><a href="${c1.link}">${c1.name}</a></div>
                    <#else>
                    <div class="nav-name" ><a href="${c1.link}">${c1.name}</a></div>
                    </#if>
                    </#list>
                </@cms_catalog >
            </div>
        </div>
        <div class="col col-lg-3">
            <div class="header-search-input-box">
                <div class="header-search-input">
                    <img src="${Prefix}images/search-icon.png" id="header_search_img">
                    <input autocomplete="off" class="form-control search my-input" placeholder="请输入关键字查询" id="header_search" type="text">
                </div>
            </div>
        </div>
    </div>
</div>
</header>